﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;

namespace OpenLS.Spreadsheet.UI.Internals
{
    internal class ShadowCollection<T, TViewModel>: INotifyCollectionChanged, IList<TViewModel>
    {
        public ShadowCollection(ObservableCollection<T> inner, Func<T, TViewModel> factory)
        {
            this._inner = inner;
            _factory = factory;
            foreach (T t in inner)
                _models.Add(factory(t));
        }
        private ObservableCollection<T> _inner;
        private readonly Func<T, TViewModel> _factory;
        List<TViewModel> _models = new List<TViewModel>();

        public event NotifyCollectionChangedEventHandler CollectionChanged;
        public IEnumerator<TViewModel> GetEnumerator()
        {
            return _models.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        public void Add(TViewModel item)
        {
            throw new NotImplementedException();
        }

        public void Clear()
        {
            throw new NotImplementedException();
        }

        public bool Contains(TViewModel item)
        {
            throw new NotImplementedException();
        }

        public void CopyTo(TViewModel[] array, int arrayIndex)
        {
            throw new NotImplementedException();
        }

        public bool Remove(TViewModel item)
        {
            throw new NotImplementedException();
        }

        public int Count
        {
            get { throw new NotImplementedException(); }
        }

        public bool IsReadOnly
        {
            get { throw new NotImplementedException(); }
        }

        public int IndexOf(TViewModel item)
        {
            throw new NotImplementedException();
        }

        public void Insert(int index, TViewModel item)
        {
            throw new NotImplementedException();
        }

        public void RemoveAt(int index)
        {
            throw new NotImplementedException();
        }

        public TViewModel this[int index]
        {
            get { throw new NotImplementedException(); }
            set { throw new NotImplementedException(); }
        }
    }
}